package com.ruoyi.draw.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.SecurityUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.draw.mapper.ModelTypeMapper;
import com.ruoyi.draw.domain.ModelType;
import com.ruoyi.draw.service.IModelTypeService;

/**
 * ModelTypeService业务层处理
 * 
 * @author Locke
 * @date 2025-10-25
 */
@Service
public class ModelTypeServiceImpl implements IModelTypeService 
{
    @Autowired
    private ModelTypeMapper modelTypeMapper;

    /**
     * 查询ModelType
     * 
     * @param id ModelType主键
     * @return ModelType
     */
    @Override
    public ModelType selectModelTypeById(Long id)
    {
        return modelTypeMapper.selectModelTypeById(id);
    }

    /**
     * 查询ModelType列表
     * 
     * @param modelType ModelType
     * @return ModelType
     */
    @Override
    public List<ModelType> selectModelTypeList(ModelType modelType)
    {
        return modelTypeMapper.selectModelTypeList(modelType);
    }

    /**
     * 新增ModelType
     * 
     * @param modelType ModelType
     * @return 结果
     */
    @Override
    public int insertModelType(ModelType modelType)
    {
        modelType.setId(System.currentTimeMillis());
        modelType.setCreateBy(SecurityUtils.getUsername());
        modelType.setCreateTime(DateUtils.getNowDate());
        return modelTypeMapper.insertModelType(modelType);
    }

    /**
     * 修改ModelType
     * 
     * @param modelType ModelType
     * @return 结果
     */
    @Override
    public int updateModelType(ModelType modelType)
    {
        modelType.setUpdateBy(SecurityUtils.getUsername());
        modelType.setUpdateTime(DateUtils.getNowDate());
        return modelTypeMapper.updateModelType(modelType);
    }

    /**
     * 批量删除ModelType
     * 
     * @param ids 需要删除的ModelType主键
     * @return 结果
     */
    @Override
    public int deleteModelTypeByIds(Long[] ids)
    {
        return modelTypeMapper.deleteModelTypeByIds(ids);
    }

    /**
     * 删除ModelType信息
     * 
     * @param id ModelType主键
     * @return 结果
     */
    @Override
    public int deleteModelTypeById(Long id)
    {
        return modelTypeMapper.deleteModelTypeById(id);
    }
}
